Conversation
Add test suite for manifest metadata fields (YAML anchors and extensions). RED PHASE: All tests fail because extra fields are currently forbidden. Tests cover: - Allowed metadata fields (.anchor, _meta, x-custom) - Unknown fields (random_field) - Mixed scenarios After implementation in GREEN phase, these tests will pass. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Implement support for YAML anchors and metadata fields in AgentsManifest. - Set extra='allow' in model_config to accept extra fields - Add validate_extra_fields() model validator to warn about unknown fields - Allowed prefixes: '.' (anchors), '_' (metadata), 'x-' (extensions) - Unknown fields log WARNING but don't raise ValidationError - Fix tests to check agent.model.identifier instead of agent.model All tests pass (GREEN phase). Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Change logger.warning from f-string to lazy % format (ruff G004) - Add isinstance(agent.model, StringModelConfig) checks for mypy strict mode - Add StringModelConfig import from llmling_models_config - Remove debug_validation.py (debug file, not needed in repo)
Add patternProperties in json_schema_extra to allow `.`, `_`, `x-` prefixed fields without YAML LSP warnings. Add comprehensive tests for schema validation and YAML anchor functionality.
|
Are these special field names part of the YAML spec? |
@phil65 Thanks for the review and these thoughtful questions! Let me address them: About the special field names These prefixes (
About the SubModel alternative This is a great suggestion! We did consider a similar design: _anchors:
shared_model: &default_model
type: native
model: "openai:gpt-4o"However, this approach has trade-offs:
The current approach preserves idiomatic YAML usage while declaring these fields via I'm happy to adjust the implementation if you prefer the SubModel approach, or we can iterate on other ideas. What do you think? |
Summary
Resolves #12 - Enables support for YAML anchors and metadata fields in
AgentsManifestconfiguration files.Changes
New Features
.,_, andx-for YAML anchors and custom metadata&default_settings) and reference them (e.g.,*default_settings) to reduce configuration duplicationImplementation
src/agentpool/models/manifest.py:extra="allow"inmodel_configto accept extra top-level fields@model_validator(mode="after")to validate and warn about unknown fieldstests/manifest/test_metadata_fields.py:.anchor,_meta,x-custom)Test Coverage
All tests passing (27/27):
Example Usage
Technical Details
validate_extra_fields()method checks all extra top-level keys.(dot) - for YAML anchors and hidden fields_(underscore) - for internal/metadata fieldsx-- for custom extensions (following OpenAPI convention)"Unknown field '{key}' in manifest. This field will be IGNORED."Related Issue
Fixes #12